"""
POST http://101.132.99.138/prod-api/login HTTP/1.1
Host: 101.132.99.138
Connection: keep-alive
Content-Length: 42
Accept: application/json, text/plain, */*
isToken: false
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537(KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Content-Type: application/json;charset=UTF-8
Origin: http://101.132.99.138
Referer: http://101.132.99.138/login?redirect=%2Findex
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9

{"username":"admin","password":"admin123"}
"""
from requests import Response
import requests
# import pytest


def login(s, base_url, username='admin', password='admin123') -> Response:
    """登录用例"""
    url = f'{base_url}prod-api/login'
    body = {
            "username": username,
            "password": password
    }
    r = s.post(url, json=body)
    return r


def login_case(base_url, username: str = 'admin', password: str = 'admin123'):
    """专门针对登录一段：公共的代码，可以服用"""
    url = f'{base_url}prod-api/login'
    body = {
        "username": username,
        "password": password
    }

    r = requests.post(url, json=body)
    print(r)
    print(r.text)
    return r


# login_case()
